<?php
	include("module.php");
	
	if(isset($_POST["coursename"]))
	{
		$newIDCourse = getMaxID("idcourse", "course") + 1;
		
		$sql = "insert into course values (" . $newIDCourse . ", ";			// ID 号码
		
		$sql .= "'" . $_POST["coursename"] . "', ";		// 课程名字
		$sql .= "'" . $_POST["startdate"] . "', ";			// 开始时间
		$sql .= "'" . $_POST["enddate"] . "')";			// 结束时间
		
		echo $sql;
		mysql_query($sql);
	}
	
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<form action="addcourse.php" method="post">
		<table>
			<tr>
				<td>课程名</td>
				<td><input name="coursename" type="text"></td>
			</tr>
			<tr>
				<td>开始日期</td>
				<td><input name="startdate" type="text"></td>
			</tr>
			<tr>
				<td>结束日期</td>
				<td><input name="enddate" type="text"></td>
			</tr>
			<tr>
				<td><input value="添加" type="submit"></td>
			</tr>
		</table>
	</form>
</body>
</html>